package top.cardone.api.vx.workflow.wfTask

import org.apache.commons.lang3.StringUtils
import top.cardone.workflow.service.WfTaskService
import top.cardone.context.ApplicationContextHolder
import top.cardone.core.CodeException

class d0003 implements java.io.Serializable {
    def input(input) {
        def wfTaskIds = input?.wfTaskIds?.split(",")

        if (!wfTaskIds) {
            throw new CodeException("wfTaskIds required", "工作流任务标识集合必填")
        }

        def wfTaskIdList = []

        for (def wfTaskId : wfTaskIds) {
            wfTaskIdList.add(["wfTaskId": wfTaskId, "flagCode": "input", "dataStateCode": "0", "endDate": new Date()])
        }

        ["wfTaskIds": wfTaskIdList]
    }

    def validation(input) {
    }

    def func(input) {
        ApplicationContextHolder.getBean(WfTaskService.class).updateListCache(input?.wfTaskIds)
    }

    def output(output) {
        ['deleteCounts': output]
    }
}